#include "connectsqlite.h"
#include <QDebug>
#include <QDir>

ConnectSQLite::ConnectSQLite()
{
    QSqlDatabase db;
    if(QSqlDatabase::contains("qt_sql_default_connection"))
     {
        db = QSqlDatabase::database("qt_sql_default_connection");
    }else
      {
        db = QSqlDatabase::addDatabase("QSQLITE");
        }
    db.setDatabaseName("E:/qt/kaoqin/database/system.db");
    qDebug()<< QDir::currentPath();
     ok=db.open();
    if(ok)
    {
        qDebug() << "Success: Connect SQLite!!";
    }else
    {
        qDebug() << "Fail: Connect SQLite!!";
    }
}

ConnectSQLite::~ConnectSQLite()
{
    QSqlDatabase::database().close();
}

